package org.toonWatch

class TempCart implements Serializable{
    
    static final PENDING = 'PENDING'
    static final INVALID = 'INVALID'
    static final FAILED = 'FAILED'
    static final COMPLETE = 'COMPLETE'
    static final CANCELLED = 'CANCELLED'


    //    int id
    int user_Id
    Double amount
    Date paymentDate
    double discountAmount
    String transactionId
    String paypalTransactionId
    String status = PENDING
    

    static constraints = {
        //       id(nullable:false, unique:true, generate: 'assigned', matches: '[0-9]{8}') //primary key
        amount(nullable:true)
        user_Id(nullable:true)
        discountAmount(nullable:true)
        paymentDate(nullable:true)
        transactionId(nullable:true)
        paypalTransactionId(nullable:true)
        paymentDate(nullable:true)
        //       voucher(nullable:true) //each shopping may or may not be entitled to a voucher
    }

    static hasMany = [transactions : Transaction]

    static mapping = {
        status inList: [TempCart.PENDING, TempCart.INVALID, TempCart.FAILED,TempCart.COMPLETE,TempCart.CANCELLED]
    }
}
